home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / VSet2.0 / Src / df.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-20  |  11.8 KB  |  281 lines  |  [TEXT/????]

  1. /*****************************************************************************
  2. *              NCSA HDF version 3.10r4
  3. *                June 25, 1991
  4. *
  5. * NCSA HDF Version 3.10r4 source code and documentation are in the public
  6. * domain.  Specifically, we give to the public domain all rights for future
  7. * licensing of the source code, all resale rights, and all publishing rights.
  8. * We ask, but do not require, that the following message be included in all
  9. * derived works:
  10. * Portions developed at the National Center for Supercomputing Applications at
  11. * the University of Illinois at Urbana-Champaign.
  12. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  13. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  14. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  15. *****************************************************************************/
  16. #ifdef RCSID
  17. static char RcsId[] = "@(#)$Revision: 3.4 $"
  18. #endif
  19. /*
  20. $Header: /pita/work/HDF/dev/RCS/src/df.h,v 3.4 90/11/28 08:12:26 mfolk beta $
  21. $Log:    df.h,v $
  22.  * Revision 3.4  90/11/28  08:12:26  mfolk
  23.  * *** empty log message ***
  24.  * 
  25.  * Revision 3.3  90/07/19  10:52:32  clow
  26.  * added DFTAG_IMCOMP as alias for DFTAG_IMC
  27.  * 
  28.  * Revision 3.2  90/05/17  17:12:32  clow
  29.  * removed #include <fortran.h> which has migrated to dfi.h
  30.  * 
  31. */
  32. /*-----------------------------------------------------------------------------
  33.  * File:    df.h
  34.  * Purpose: header file for HDF routines
  35.  * Invokes: dfi.h
  36.  * Contents: 
  37.  *  Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata
  38.  *  Procedure type definitions
  39.  *  Global variables
  40.  *  Tag definitions
  41.  *  Error return codes
  42.  *  Logical constants
  43.  * Remarks: This file is included with user programs
  44.  *          Since it includes stdio.h etc., do not include these after df.h
  45.  *---------------------------------------------------------------------------*/
  46.  
  47.  
  48. #ifndef DFTAG_NULL              /* avoid re-inclusion */
  49.  
  50. /* include DF (internal) header information */
  51. #include <dfi.h>
  52.  
  53. /*-------------------------------------------------------------------------*/
  54. /*                      Type declarations                                   */
  55.  
  56. typedef struct DFddh {        /*format of data descriptor headers in file*/
  57.     int16 dds;            /* number of dds in header block */
  58.     int32 next;            /* offset of next header block */
  59. } DFddh;
  60.  
  61. typedef struct DFdd {        /* format of data descriptors as in file */
  62.     uint16 tag;            /* data tag */
  63.     uint16 ref;            /* data reference number */
  64.     int32 offset;        /* offset of data element in file */
  65.     int32 length;        /* number of bytes */
  66. } DFdd;
  67.  
  68. /* descriptor structure is same as dd structure.  ###Note: may be changed */
  69. #define DFdesc DFdd
  70.  
  71. /* DLE is the internal structure which stores data descriptor information */
  72. /* It is a linked list of DDs */
  73. typedef struct DFdle {        /* Data List element */
  74.     struct DFdle *next;        /* link to next dle */
  75.     DFddh ddh;            /* To store headers */
  76.     DFdd dd[1];            /* dummy size */
  77. } DFdle;
  78.  
  79. /* DF is the internal structure associated with each DF file */
  80. /* It holds information associated with the file as a whole */
  81. /* ### Note: there are hooks for having multiple DF files open at a time */
  82. typedef struct DF {
  83.     DFdle *list;        /* Pointer to the DLE list */
  84.     DFdle *last_dle;        /* last_dle and last_dd are used in searches */
  85.                 /* to indicate element returned */
  86.                 /* by previous call to DFfind */
  87.     int type;            /* 0= not in use, 1= normal, -1 = multiple */
  88.                 /* this is a hook for when */
  89.                 /* multiple files are open */
  90.     int access;            /* permitted access types: */
  91.                 /* 0=none, 1=r, 2=w, 3=r/w */
  92.     int changed;        /* True if anything in DDs modified */
  93.                 /* since last write */
  94.     uint16 last_tag;        /* Last tag searched for by DFfind */
  95.     uint16 last_ref;        /* Last reference number searched for */
  96.     int last_dd;        /* see last_dle */
  97.     int defdds;            /* default numer of DD's in each block */
  98.     int up_access;        /* access permissions to element being */
  99.                 /* read/updated. Used by DFstart */
  100.     DFdd *up_dd;        /* DD of element being read/updated, */
  101.                 /* used by DFstart */
  102.     /* file handle is a file pointer or file descriptor depending on whether */
  103.     /* we use buffered or unbuffered i/o */
  104. #ifdef DF_BUFFIO
  105.     FILE *file;            /* file pointer */
  106. #else /*DF_BUFFIO*/
  107.     int file;            /* file descriptor */
  108. #endif /*DF_BUFFIO*/
  109. } DF;
  110.  
  111.  
  112. typedef struct DFdi {   /* data identifier: specifies data element uniquely */
  113.     uint16 tag;
  114.     uint16 ref;
  115. } DFdi;
  116.  
  117.  
  118.  
  119. typedef struct DFdata { /* structure for returning status information */
  120.     int version;        /* version number of program */
  121. } DFdata;
  122.  
  123. /*--------------------------------------------------------------------------*/
  124. /*                          Procedure types                                 */
  125.  
  126. #ifndef VMS
  127. DF *DFopen();
  128. int32 DFgetelement(), DFread(), DFseek(), DFwrite();
  129. uint16 DFnewref();
  130. char *DFIgetspace(), *DFIfreespace(), *DFIf2cstring();
  131. #else /*VMS*/
  132.             /* for VMS need to prepend _ to avoid name conflict with Fortran */
  133. DF *_DFopen();
  134. int32 _DFgetelement(), _DFread(), _DFseek(), _DFwrite();
  135. uint16 _DFnewref();
  136. char *_DFIgetspace(), *_DFIfreespace(), *_DFIf2cstring();
  137. #endif /*VMS*/
  138.  
  139. /*--------------------------------------------------------------------------*/
  140. /*                          Global Variables                                */
  141.  
  142. #ifndef DFMASTER
  143. extern
  144. #endif /*DFMASTER*/
  145. int DFerror;            /* Error code for DF routines */
  146.  
  147. /*--------------------------------------------------------------------------*/
  148. /*                           Tag Definitions                                */
  149.  
  150. #define DFREF_WILDCARD ((uint16)0) /* wildcard ref for searches */
  151.  
  152. #define DFTAG_WILDCARD ((uint16)0) /* wildcard tag for searches */
  153. #define DFTAG_NULL  ((uint16)1)    /* empty DD */
  154.  
  155. /* utility set */
  156. #define DFTAG_FID   ((uint16)100) /* File identifier */
  157. #define DFTAG_FD    ((uint16)101) /* File description */
  158. #define DFTAG_TID   ((uint16)102) /* Tag identifier */
  159. #define DFTAG_TD    ((uint16)103) /* Tag descriptor */
  160. #define DFTAG_DIL   ((uint16)104) /* data identifier label */
  161. #define DFTAG_DIA   ((uint16)105) /* data identifier annotation */
  162. #define DFTAG_NT    ((uint16)106) /* number type */
  163. #define DFTAG_MT    ((uint16)107) /* machine type */
  164.  
  165. /* raster-8 set */
  166. #define DFTAG_ID8   ((uint16)200) /* 8-bit Image dimension */
  167. #define DFTAG_IP8   ((uint16)201) /* 8-bit Image palette */
  168. #define DFTAG_RI8   ((uint16)202) /* Raster-8 image */
  169. #define DFTAG_CI8   ((uint16)203) /* RLE compressed 8-bit image */
  170. #define DFTAG_II8   ((uint16)204) /* IMCOMP compressed 8-bit image */
  171.  
  172. /* Raster Image set */
  173. #define DFTAG_ID    ((uint16)300) /* Image DimRec */
  174. #define DFTAG_LUT   ((uint16)301) /* Image Palette */
  175. #define DFTAG_RI    ((uint16)302) /* Raster Image */
  176. #define DFTAG_CI    ((uint16)303) /* Compressed Image */
  177.  
  178. #define DFTAG_RIG   ((uint16)306) /* Raster Image Group */
  179. #define DFTAG_LD    ((uint16)307) /* Palette DimRec */
  180. #define DFTAG_MD    ((uint16)308) /* Matte DimRec */
  181. #define DFTAG_MA    ((uint16)309) /* Matte Data */
  182. #define DFTAG_CCN   ((uint16)310) /* color correction */
  183. #define DFTAG_CFM   ((uint16)311) /* color format */
  184. #define DFTAG_AR    ((uint16)312) /* aspect ratio */
  185.  
  186. #define DFTAG_DRAW  ((uint16)400) /* Draw these images in sequence */
  187. #define DFTAG_RUN   ((uint16)401) /* run this as a program/script */
  188.  
  189. #define DFTAG_XYP   ((uint16)500) /* x-y position */
  190. #define DFTAG_MTO   ((uint16)501) /* machine-type override */
  191.  
  192. /* Tektronix */
  193. #define DFTAG_T14   ((uint16)602) /* TEK 4014 data */
  194. #define DFTAG_T105  ((uint16)603) /* TEK 4105 data */
  195.  
  196. /* Scientific Data set */
  197. #define DFTAG_SDG   ((uint16)700) /* Scientific Data Group */
  198. #define DFTAG_SDD   ((uint16)701) /* Scientific Data DimRec */
  199. #define DFTAG_SD    ((uint16)702) /* Scientific Data */
  200. #define DFTAG_SDS   ((uint16)703) /* Scales */
  201. #define DFTAG_SDL   ((uint16)704) /* Labels */
  202. #define DFTAG_SDU   ((uint16)705) /* Units */
  203. #define DFTAG_SDF   ((uint16)706) /* Formats */
  204. #define DFTAG_SDM   ((uint16)707) /* Max/Min */
  205. #define DFTAG_SDC   ((uint16)708) /* Coord sys */
  206. #define DFTAG_SDT   ((uint16)709) /* Transpose */
  207.  
  208. /* compression schemes */
  209. #define DFTAG_RLE   ((uint16)11) /* run length encoding */
  210. #define DFTAG_IMC   ((uint16)12) /* IMCOMP compression */
  211. #define DFTAG_IMCOMP   ((uint16)12) /* IMCOMP compression */
  212.  
  213. /*--------------------------------------------------------------------------*/
  214. /*                          Error Return Codes                              */
  215.  
  216. #define DFE_NOERROR     0   /* No error */
  217. #define DFE_FNF         -1  /* File not found error */
  218. #define DFE_DENIED      -2  /* Access to file denied */
  219. #define DFE_ALROPEN     -3  /* File already open */
  220. #define DFE_TOOMANY     -4  /* Too Many DF's or files open */
  221. #define DFE_BADNAME     -5  /* Bad file name on open */
  222. #define DFE_BADACC      -6  /* Bad file access mode */
  223. #define DFE_BADOPEN     -7  /* Other open error */
  224. #define DFE_NOTOPEN     -8  /* File can't be closed 'cause it isn't open */
  225. #define DFE_CANTCLOSE   -9  /* fclose wouldn't work! */
  226. #define DFE_DFNULL      -10 /* DF is a null pointer */
  227. #define DFE_ILLTYPE     -11 /* DF has an illegal type: internal error */
  228. #define DFE_UNSUPPORTED -12 /* Feature not currently supported */
  229. #define DFE_BADDDLIST   -13 /* The DD list is non-existent: internal error */
  230. #define DFE_NOTDFFILE   -14 /* This is not a DF file and it is not 0 length */
  231. #define DFE_SEEDTWICE   -15 /* The DD list already seeded: internal error */
  232. #define DFE_NOSPACE     -16 /* Malloc failed */
  233. #define DFE_NOSUCHTAG   -17 /* There is no such tag in the file: search failed*/
  234. #define DFE_READERROR   -18 /* There was a read error */
  235. #define DFE_WRITEERROR  -19 /* There was a write error */
  236. #define DFE_SEEKERROR   -20 /* There was a seek error */
  237. #define DFE_NOFREEDD    -21 /* There are no free DD's left: internal error */
  238. #define DFE_BADTAG      -22 /* illegal WILDCARD tag */
  239. #define DFE_BADREF      -23 /* illegal WILDCARD reference # */
  240. #define DFE_RDONLY      -24 /* The DF is read only */
  241. #define DFE_BADCALL     -25 /* Calls in wrong order */
  242. #define DFE_BADPTR      -26 /* NULL ptr argument */
  243. #define DFE_BADLEN      -27 /* negative len specified */
  244. #define DFE_BADSEEK     -28 /* Attempt to seek past end of element */
  245. #define DFE_NOMATCH     -29 /* No (more) DDs which match specified tag/ref */
  246. #define DFE_NOTINSET    -30 /* Warning: Set contained unknown tag: ignored */
  247. #define DFE_BADDIM      -31 /* negative or zero dimensions specified */
  248. #define DFE_BADOFFSET   -32 /* Illegal offset specified */
  249. #define DFE_BADSCHEME   -33 /* Unknown compression scheme specified */
  250. #define DFE_NODIM       -34 /* No dimension record associated with image */
  251. #define DFE_NOTENOUGH   -35 /* space provided insufficient for size of data */
  252. #define DFE_NOVALS      -36 /* Values not available */
  253. #define DFE_CORRUPT     -37 /* File is corrupted */
  254. #define DFE_BADCONV     -37 /* Don't know how to convert data type */
  255. #define DFE_BADFP       -38 /* The file contained an illegal floating point no*/
  256. #define DFE_NOREF       -39 /* no more reference numbers are available */
  257. #define DFE_BADDATATYPE -40 /* unknown or unavailable data type specified */
  258. #define DFE_BADMCTYPE   -41 /* unknown or unavailable machine type specified */
  259. #define DFE_BADNUMTYPE  -42 /* unknown or unavailable number type specified */
  260. #define DFE_BADORDER    -43 /* unknown or illegal array order specified */
  261. #define DFE_NOTIMPL     -44 /* This feature not yet implemented */
  262.  
  263. /*--------------------------------------------------------------------------*/
  264. /*                          Logical Constants                               */
  265.  
  266. #define DFACC_READ      1   /* Read Access */
  267. #define DFACC_WRITE     2   /* Write Access */
  268. #define DFACC_CREATE    4   /* force file to be created */
  269. #define DFACC_ALL       7   /* the logical and of all the above values */
  270.  
  271. /*--------------------------------------------------------------------------*/
  272. /*                          Settype Constants                               */
  273.  
  274.  
  275. #endif /*DFTAG_NULL*/
  276.